Networking and Communications
Assignment:
The work this week is to design and build a wireless or non wireless network connecting at least two processors.
My Wireless Network Device:
My idea for my network device this week is have master board and two slave board with two LEDs . The idea is to program the master to control the LEDS light blinking with different output.
Tools needed:
1- Eagle Software
2- Cirquoid (milling machine) and Cirq Wizard
3- Soldering Equipments
4- Copper Boards
5- Electronic Components
The master I used is from Serial bus called “BOARD” and the slave from serial bus also called”board” from fabacademy.org website.
The master “Board”
The “Master”Components needed are:
1- attitiny 45
2- 3 10K resistors
3-2X2 pin header
4-I2C
5-FTDI
6- ISP
7- Capacitor 1 uf
The slave “Board”
The Components needed are:
1- attitiny 45
2- I2C (2x2)
3- 3 10 k resistors
4- ISP (3x2)
5- Capacitors 1uf
6- 1 resistors 399 Ohm
7- LED blue ( another slave with blue LED)
Making the board:
I used the eagle software as in the previous week for schematic and connecting the components together and find the optimum design of my board using the auto-router.
My “MASTER” design after using auto router
Then I convert my file to cmp for milling using the cam processor in eagle.
After testing and fining the right depth (Z-Axis) as previous week I milled my board using Cirquoid. After milling, I started soldering the components into the copper board.
My “Slave” design after using auto router
Then I convert my file to cmp for milling using the cam processor in eagle.
After testing and fining the right depth (Z-Axis) as previous week I milled my board using Cirquoid. After milling, I started soldering the components into the copper board.
Soldering:
The soldered Master board
The soldered Slave board
Program:
Once the soldering is done then we have to program the sonar and LED to see if it works.
Master :
void setup()
{
TinyWireM.begin(); // join i2c bus (address optional for master)
}
byte x = 0;
byte x1 = 0;
void loop() {
TinyWireM.beginTransmission(0x1);
TinyWireM.write(++x % 2);
TinyWireM.endTransmission();
delay(1000);
TinyWireM.beginTransmission(0x2);
TinyWireM.write(++x1 % 2);
TinyWireM.endTransmission();
delay(1000);
}
Slave:
#define output(directions, pin) (directions |= (1 << pin)) // set port direction for output
#define input(directions, pin) (directions &= (~(1 << pin))) // set port direction for input
#define set(port, pin) (port |= (1 << pin)) // set port pin
#define clear(port, pin) (port &= (~(1 << pin))) // clear port pin
#define LED_PIN PB4
#define I2C_SLAVE_ADDRESS 0x1 // Address of the slave 1
#include <TinyWireS.h>
void setup()
{
output(DDRB, LED_PIN);
clear(PORTB, LED_PIN);
TinyWireS.begin(I2C_SLAVE_ADDRESS); // join i2c network
}
void loop()
{
byte recd = 1;
if(TinyWireS.available()) {
recd = TinyWireS.receive();
if(recd == 1) {
clear(PORTB, LED_PIN);
} else {
set(PORTB, LED_PIN);
}
}
The Result